package com.afc.struts.test.person;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.afc.struts.Action;
import com.afc.struts.test.data.PersonDao;
import com.afc.struts.test.model.Person.DefaultPerson;

public class PersonAddOkAction implements Action<PersonForm>
{
  @Override
  public String execute(PersonForm anActionForm, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletException
  {
    PersonDao.getInstance().create(new DefaultPerson(anActionForm.getFirstName(), anActionForm.getLastName(), anActionForm.getSize(), anActionForm.getBirthday(), anActionForm.getBestFriend()));
    return "/pages/persons.jsp";
  }
}
